#include"UdpServer.hpp"
#include<memory>
#include<stdlib.h>
#include<string>

void Usage(std::string proc)
{
    std::cerr << "usage: " << proc << " serverport" << std::endl;
}

//./udpserver serverip serverport
//./udpserver serverport
int main(int argc , char* argv[])
{
    EnableConsoleLogStrategy();//日志刷新策略
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(0);
    }

    // std::string ip = argv[1];
    uint16_t port = std::stoi(argv[1]);
    std::unique_ptr<UdpServer> usvr = std::make_unique<UdpServer>(port);
    usvr->Init();
    usvr->Start();

    return 0;
}